<template>
  <div id="app" class="container">
    <Nav v-if="isShowNav" />
    <div class="layout">
      <router-view />
    </div>
  </div>
</template>

<script lang="ts">
import { Vue, Watch } from 'vue-property-decorator'
import Component from 'vue-class-component'
import { Route } from 'vue-router'
import Nav from '@/components/nav.vue'

@Component({
  components: {
    Nav,
  },
})
export default class App extends Vue {
  private isShowNav = false

  @Watch('$route')
  routeChange(val: Route): void {
    console.log(val, 1111)
    if (val && val.path === '/') {
      this.isShowNav = false
    } else {
      this.isShowNav = true
    }
  }

  mounted(): void {
    this.routeChange(this.$route)
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
